package com.glsc.ngateway.common.base.domain.mysql.gateway.shortmsg;


import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.SendStatus;
import com.glsc.ngateway.common.base.utils.NGSMDateTimeFormatter;

import javax.persistence.*;
import java.time.LocalDate;
import java.time.LocalTime;

/**
 * 用于存放发送短信的历史记录
 * 最好加一个夜维任务，否则表膨胀较快会有性能问题
 */
@Entity
@Table(name = "t_notice_message_nsend_table")
public class NoticeMessageSend {

    // 数据库自增ID
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    // 短信Id
    @Column(name = "message_id")
    private String messageId;

    // 接收人手机号码
    @Column(name = "telephone")
    private String telephone;

    // 发送状态
    @Column(name = "send_status")
    private String sendStatus = SendStatus.RECIEVED.getCode();

    // 发送时间
    @Column(name = "send_time")
    private Long sendTime = LocalTime.now().toNanoOfDay();

    // 重复次数
    @Column(name = "repeat_times")
    private Integer repeatTimes = 0;

    // 发送每天小时时间
    @Column(name = "send_hour")
    private String sendHour = "" + LocalTime.now().getHour();

    // 发送日期
    @Column(name = "send_date")
    private String sendDate = LocalDate.now().format(NGSMDateTimeFormatter.df_dt);

    // 业务代码
    @Column(name = "biz_code")
    private String bizCode = "0007915002";

    // 发送方业务IP
    @Column(name = "op_state")
    private String opState;

    //短信内容
    @Column(name = "content")
    private String content;

    //返回内容
    @Column(name = "rescontent")
    private String rescontent;

    //系統編號
    @Column(name = "sysid")
    private String sysid;

    public String getRescontent() {
        return rescontent;
    }

    public void setRescontent(String rescontent) {
        this.rescontent = rescontent;
    }

    public String getSysid() {
        return sysid;
    }

    public void setSysid(String sysid) {
        this.sysid = sysid;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMessageId() {
        return messageId;
    }

    public void setMessageId(String messageId) {
        this.messageId = messageId;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getSendStatus() {
        return sendStatus;
    }

    public void setSendStatus(String sendStatus) {
        this.sendStatus = sendStatus;
    }

    public Long getSendTime() {
        return sendTime;
    }

    public void setSendTime(Long sendTime) {
        this.sendTime = sendTime;
    }

    public Integer getRepeatTimes() {
        return repeatTimes;
    }

    public void setRepeatTimes(Integer repeatTimes) {
        this.repeatTimes = repeatTimes;
    }

    public String getSendHour() {
        return sendHour;
    }

    public void setSendHour(String sendHour) {
        this.sendHour = sendHour;
    }

    public String getSendDate() {
        return sendDate;
    }

    public void setSendDate(String sendDate) {
        this.sendDate = sendDate;
    }

    public String getBizCode() {
        return bizCode;
    }

    public void setBizCode(String bizCode) {
        this.bizCode = bizCode;
    }

    public String getOpState() {
        return opState;
    }

    public void setOpState(String opState) {
        this.opState = opState;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }


    @Override
    public String toString() {
        return "NoticeMessageSend{" +
                "id=" + id +
                ", messageId='" + messageId + '\'' +
                ", telephone='" + telephone + '\'' +
                ", sendStatus='" + sendStatus + '\'' +
                ", sendTime=" + sendTime +
                ", repeatTimes=" + repeatTimes +
                ", sendHour='" + sendHour + '\'' +
                ", sendDate='" + sendDate + '\'' +
                ", bizCode='" + bizCode + '\'' +
                ", opState='" + opState + '\'' +
                ", content='" + content + '\'' +
                ", rescontent='" + rescontent + '\'' +
                ", sysid='" + sysid + '\'' +
                '}';
    }
}
